//
//  FirstViewController.swift
//  testsetting
//
//  Created by GAOMO on 2019/10/15.
//  Copyright © 2019 GAOMO. All rights reserved.
//

import UIKit

class FirstViewController: UIViewController {
    var alert : UIAlertController!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        print("second")
        
    }
    
    override func viewDidAppear(_ animated: Bool) {
          alert = UIAlertController(title: "提示", message: "你确定要离开？", preferredStyle:.alert)
              
              let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: {
                action in
                print("取消")
                
              })
                    let okAction = UIAlertAction(title: "好的", style: .default, handler: {
                        action in
                        print("点击了确定")
                    })
                    alert.addAction(cancelAction)
                    alert.addAction(okAction)
                    self.present(alert, animated: true, completion: nil)
    }
    
}
